
package com.work.db.entity;

import java.io.Serializable;
import java.util.List;

import javax.persistence.*;

@Entity
@Table(name = "ROLE")
public class Role extends BaseEntity implements Serializable {

	@Transient
	private static final long serialVersionUID = 6110755477766873251L;

	@Column(name = "ROLE_NAME", nullable = false, length = 50)
	private String name;

	@Column(name = "DESCRIPTION", nullable = false, length = 50)
	private String description;

	@ManyToMany(fetch = FetchType.LAZY)
	@JoinTable(name = "USER_ROLE", joinColumns = @JoinColumn(name = "ROLE_ID"), inverseJoinColumns = @JoinColumn(name = "USER_ID"))
	private List<User> users;

	public Role() {
		super();
	}

	public String getName()
	{
		return name;
	}

	public void setName(String name)
	{
		this.name = name;
	}

	public String getDescription()
	{
		return description;
	}

	public void setDescription(String description)
	{
		this.description = description;
	}

	public List<User> getUsers()
	{
		return users;
	}

	public void setUsers(List<User> users)
	{
		this.users = users;
	}

}
